package com.lvc.fotolivro.client;

import com.google.gwt.core.client.GWT;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Cursor;
import com.smartgwt.client.types.DragAppearance;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ShowContextMenuEvent;
import com.smartgwt.client.widgets.events.ShowContextMenuHandler;

/**
 * Esta classe representa uma foto do fotolivro
 * 
 * @author Larissa Nepomuceno Costa
 * @version 1
 * @since 08/10/2012
 */
public class MyDropPhoto extends Img {

	public MyDropPhoto(String caminho, int left, int top) {
		setSrc(GWT.getHostPageBaseURL() + caminho);
		setCursor(Cursor.MOVE);
//		setCanDrag(true);
//		setCanDrop(true);
		setLeft(left);  
        setTop(top); 
		setDragAppearance(DragAppearance.TARGET);
		setCanDragReposition(true);
		setCanDragResize(true);
		setLayoutAlign(Alignment.CENTER);
		addShowContextMenuHandler(new ShowContextMenuHandler() {
			public void onShowContextMenu(ShowContextMenuEvent event) {
				destroy();
				event.cancel();
			}
		});
	}
}